package com.tungse.emnu;

public enum TrafficLight implements Activity {
    RED(30) {
        @Override
        public void showMessage() {
            System.out.println("Stop!");
        }
    },
    YELLOW(5) {
        @Override
        public void showMessage() {
            System.out.println("Get ready to stop.");
        }
    },
    GREEN(25) {
        @Override
        public void showMessage() {
            System.out.println("Go!");
        }
    };

    private int duration;

    TrafficLight(int duration) {
        this.duration = duration;
    }

    public int getDuration() {
        return duration;
    }

    public void doActivity() {
        System.out.println("The light is " + this.name() + " for " + duration + " seconds.");
    }

    public abstract void showMessage();
}